#include<iostream>
using namespace std;

class Two;

class One {
    private:
        int x;
    public:
        One(int x = 0):x(x) {}
        void setY(Two&);
};

class Two {
    private:
        int y;
        friend void One::setY(Two&);
    public:
        Two(int y):y(y) {}
        void show() {
            cout << "y = " << y << endl;
        }
};

void One::setY(Two& obj) {
    obj.y = x;
}

int main() {
    One one(2);
    Two two(3);
    two.show();
    one.setY(two);
    two.show();
    return 0;
}
